﻿using AutoMapper;
using J.FoodManageSet.Application.Command.GroupingCommand;
using J.FoodRepository.InterFace;
using MediatR;

namespace J.FoodManageSet.Application.CommandHandler.GroupingCommandHandler
{
    /// <summary>
    /// 菜品分组删除
    /// </summary>
    public class GroupingDeleteCommandHandler : IRequestHandler<GroupingDeleteCommand, int>
    {

        private readonly IGroupingRepository _groupingRepository;

        public GroupingDeleteCommandHandler(IGroupingRepository groupingRepository)
        {
            _groupingRepository = groupingRepository;
        }
        public async Task<int> Handle(GroupingDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await _groupingRepository.GroupingDelete(request.GroupingId);
            return list;
        }
    }
}
